﻿<%@ Page Language="C#" MasterPageFile="~/Web/FarmMaster.master" AutoEventWireup="true" CodeFile="Question.aspx.cs" Inherits="Web_Question" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    <link href="../App_Themes/WebBlue/Question.css" rel="stylesheet" type="text/css" />
    <script src="../js/jquery-1.7.2.min.js" type="text/javascript"></script>
    <script language="javascript" type="text/javascript">
        $(document).ready(function () {
            $('#<%=Save.ClientID %>').click(function () {
                if ($.trim($('#<%=Name.ClientID %>').val()) == '') {
                    alert('请输入您的姓名。');
                    $('#<%=Name.ClientID %>').focus();

                    return false;
                }

                if ($.trim($('#<%=Telphone.ClientID %>').val()) == '') {
                    alert('请输入您的联系方式。');
                    $('#<%=Telphone.ClientID %>').focus();

                    return false;
                }

                if ($.trim($('#<%=Country.ClientID %>').val()) == '') {
                    alert('请选择您所在的区/县。');
                    $('#<%=Country.ClientID %>').focus();

                    return false;
                }

                if ($.trim($('#<%=Street.ClientID %>').val()) == '') {
                    alert('请选择您所在的街道/镇。');
                    $('#<%=Street.ClientID %>').focus();

                    return false;
                }

                if ($.trim($('#<%=Village.ClientID %>').val()) == '') {
                    alert('请选择您所在的社区/村。');
                    $('#<%=Village.ClientID %>').focus();

                    return false;
                }

                if ($.trim($('#<%=Address.ClientID %>').val()) == '') {
                    alert('请输入您的详细地址。');
                    $('#<%=Address.ClientID %>').focus();

                    return false;
                }

                if ($.trim($('#<%=QuestionTitle.ClientID %>').val()) == '') {
                    alert('请输入问题摘要。');
                    $('#<%=QuestionTitle.ClientID %>').focus();

                    return false;
                }

                if ($.trim($('#<%=Kind.ClientID %>').val()) == '') {
                    alert('请选择问题的类别。');
                    $('#<%=Kind.ClientID %>').focus();

                    return false;
                }

                if ($.trim($('#<%=Subject.ClientID %>').val()) == '') {
                    alert('请选择问题所属专业。');
                    $('#<%=Subject.ClientID %>').focus();

                    return; false;
                }

                if ($.trim($('#<%=Course.ClientID %>').val()) == '') {
                    alert('请选择问题的方向。');
                    $('#<%=Course.ClientID %>').focus();

                    return false;
                }

                var cnt = $('#<%=Teachers.ClientID %>').children().children().children().children(':checked').size();
                if (cnt <= 0) {
                    alert('请选择提问的教师。');
                    return false;
                } else if (cnt > 3) {
                    alert('您最多只能选择同时向 3 位教师提问问题。');
                    return false;
                }

                return true;
            });

            $('table#<%=Teachers.ClientID %>').css('width', '400px');
        });
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <div id="main">
		<div class="left">
			<div class="left1">
				<div id="PARENT">
					<ul	id="navv">
						<li class="first"><a>在线答疑</a>
						</li>
                        <li><a href="Question.aspx">在线答疑</a></li> 
                        <li><a href="ListQuestions.aspx">已有问题</a></li>
					</ul>
				</div>
			</div>
			<div class="left2" style="padding-top:13px;">
				<div class="tle">
					<span class="text1">培训通知</span>
				</div>
				<div class="tents">
					<ul style=" padding-top:5px;">
                        <%
                        if (ts.Count() != 0)
                        {
                            foreach (Train aT in ts)
                            {
                                string memo = aT.Name + "将于" + string.Format("{0:yyyy-MM-dd HH:mm}", aT.Started) + "在" + aT.Address + "举办";
                    
                                if (aT.Amended != null)
                                {
                    %>
                                <li>[<span style="color:#f60">变更公示</span>]<a href='ViewTrain.aspx?pid=<%=aT.ID %>'><%=memo.Length > 7 ? memo.Substring(0, 6) + "..." : memo%></a></li>
                     <%                                                    
                                }
                                else
                                { 
                     %>    <li><a href='ViewTrain.aspx?pid=<%=aT.ID %>'><%=memo.Length > 12 ? memo.Substring(0, 11) + "..." : memo%></a></li>
                                                
                    <%                       } 
                            }
                        }     
                    %>
						
					</ul>
				</div>
			</div>
			<div class="left2">
				<div class="tle">
					<span class="text1">最新动态</span>
				</div>
				<div class="tents">
					<ul style=" padding-top:5px;">
						<asp:Repeater ID="Repeater3" runat="server">
                            <ItemTemplate>
                                <li><a href='<%=Toolkit.ApplicationRoot %>/Html/<%#Eval("url") %>'><%#Eval("Title").ToString().Length>12?Eval("Title").ToString().Substring(0,11)+"...":Eval("Title") %></a></li>
                            </ItemTemplate>
                        </asp:Repeater>
					</ul>
				</div>
			</div>
		</div>
		<div class="right">
			<div class="headline">
				您的当前位置：首页-->在线答疑
			</div>
			<div class="content">
                <table cellpadding="0" cellspacing="1" class="Question">
                    <tr>
                        <td align="right" style="width:100px">姓名：</td>
                        <td align="center"><asp:TextBox ID="Name" runat="server" Width="130px"></asp:TextBox></td>
                        <td align="right" style="width:100px">联系方式：</td>
                        <td align="left" colspan="3"><asp:TextBox ID="Telphone" runat="server" Width="98%"></asp:TextBox></td>
                    </tr>
                    <tr>
                        <td align="right" style="width:100px">区/县：</td>
                        <td align="center">
                            <asp:DropDownList ID="Country" runat="server" Width="130px" 
                                AutoPostBack="True" onselectedindexchanged="Country_SelectedIndexChanged"></asp:DropDownList></td>
                        <td align="right" style="width:100px">街道/镇：</td>
                        <td align="center">
                            <asp:DropDownList ID="Street" runat="server" Width="130px" 
                                AutoPostBack="True" onselectedindexchanged="Street_SelectedIndexChanged"></asp:DropDownList></td>
                        <td align="right" style="width:100px">社区/村：</td>
                        <td align="center"><asp:DropDownList ID="Village" runat="server" Width="130px"></asp:DropDownList></td>
                    </tr>
                    <tr>
                        <td align="right" style="width:100px">地址：</td>
                        <td colspan="5" align="left"><asp:TextBox ID="Address" runat="server" Width="98%"></asp:TextBox></td>
                    </tr>
                    <tr>
                        <td align="right" style="width:100px">问题摘要：</td>
                        <td align="left" colspan="5"><asp:TextBox ID="QuestionTitle" runat="server" Width="98%"></asp:TextBox></td>
                    </tr>
                    <tr>
                        <td align="right" style="width:100px">问题描述：</td>
                        <td align="left" colspan="5"><asp:TextBox ID="Memo" runat="server" Width="98%" Height="150px" TextMode="MultiLine"></asp:TextBox></td>
                    </tr>
                    <tr>
                        <td align="right" style="width:100px">问题类别：</td>
                        <td align="center">
                            <asp:DropDownList ID="Kind" runat="server" Width="130px" 
                                AutoPostBack="True" onselectedindexchanged="Kind_SelectedIndexChanged"></asp:DropDownList></td>
                        <td align="right" style="width:100px">专业：</td>
                        <td align="center">
                            <asp:DropDownList ID="Subject" runat="server" Width="130px" 
                                AutoPostBack="True" onselectedindexchanged="Subject_SelectedIndexChanged"></asp:DropDownList></td>
                        <td align="right" style="width:100px">方向：</td>
                        <td align="center">
                            <asp:DropDownList ID="Course" runat="server" Width="130px"></asp:DropDownList></td>
                    </tr>
                    <tr>
                        <td align="right" style="width:100px">提问教师：</td>
                        <td align="left" colspan="5"><asp:CheckBoxList ID="Teachers" runat="server"></asp:CheckBoxList></td>
                    </tr>
                    <tr>
                        <td align="center" colspan="6"><asp:Button ID="Save" runat="server" Text="提问" 
                                onclick="Save_Click" /></td>
                    </tr>
                </table>
			</div>
		</div>
	</div>
      
</asp:Content>